<template>
	<view>
		<view class="message-list">
			<cc-pullScroolView class="pullScrollView" ref="pullScroll" :back-top="true" :pullDown="pullDown">
				<view>
					<view class="item-message" @click="toDetail(item)" v-for="(item,index) in list" :key="index">
						<view class="message-type">
							<view class="message-title">{{item.name}}</view>
						</view>
					</view>
				</view>
				<blankPage img="https://qiniu-cdn.maeiyun.com/imgs/blank/no_order.png" text="暂无内容" :width="161" :height="129" v-show="list.length == 0"></blankPage>
			</cc-pullScroolView>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				page:1,
				total:'',
			}
		},
		onLoad() {
			this.pullDown()
		},
		methods: {
			toDetail(e) {
				let data = {
					content:e.content,
					name:e.name
				}
				uni.navigateTo({
					url:`/technician/index/notice?id=${e.id}`
				})
			},
			// 下拉刷新
			pullDown(pullScroll) {
				this.page = 1
				this.list = []
				uni.showLoading()
				this.getList()
			},
			getList(){
				let url = {
					url:"index/platformNotice",
					method: "get"
				}
				this.request.httpTokenRequest(url, {
					page:this.page,
					type:2
				}).then(res => {
					if (res.code == 0) {
						uni.hideLoading()
						this.list.push(...res.data.data)
						this.total = res.data.total
					} else {
						this.$util.msg(res.msg)
						return
					}
				}, error => {})
			}
		},
		onReachBottom() {
			if(this.list.length < this.total){
				this.page++
				this.getList()
			}
		}
	}
</script>

<style lang="scss">
	.message-list {
		padding: 30rpx;
		// padding-top: var(--status-bar-height);
	}

	.item-message {
		display: flex;
		align-items: center;
		height: 139rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 30rpx;
		box-sizing: border-box;
		margin-bottom: 30rpx;

		.message-icon {
			width: 57rpx;
			height: 60rpx;
		}

		.message-type {

			// margin-left: 45rpx;
			.message-title {
				font-size: 28rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #08090A;
			}

			.message-info {
				font-size: 22rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #A3A3A3;
				margin-top: 10rpx;
			}
		}
	}
</style>